home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac 1993 September
/
clonecd
/
September 93.img
/
Archives
/
Applications
/
Graphics
/
Fractals
/
Mandelzot 3.0.7
/
MandelZot file format
< prev
next >
Wrap
Text File
|
1991-11-01
|
9KB
|
301 lines
MandelZot data files (whether coordinate, bitmap, dwell, compressed dwell,
or colorset) consist of a sequence of variable-sized blocks. Each block
starts with a fixed-size header containing a save-file signature type
('ManD'), a block code number, a block version number, and the byte count
for the block data itself.
When it has proven necessary to add new fields to a block (adding information),
the block version number is incremented, and the new fields are added to the
end of the block. Fields are _never_ removed from a block, nor is the
arrangement of fields within a block ever altered.
When writing a save-file, each version of MandelZot will write the most
up-to-date version of each block that it is aware of. When reading a
save-file from disk, each version of MandelZot will read in as much of
the block as it knows how to parse (based on the most up-to-date version
it understands) and will skip the rest. If a data block is of an older
version, and is shorter than the version that MandelZot expects, MandelZot
will read in the available data, and provide reasonable default values for
any fields not available in the shorter block.
Data is written in 68000 (big-endian) format. Floating point numbers are
usually represented in "short double" (IEEE double-precision, 8-byte)
format. In a few cases, values are represented in SANE extended-precision
(12-byte) format.
A minimal dwell-save file, being created by an external application, would
consist of:
- A CoordBlock, version 0. This would identify the portion of the complex
plane under examination.
- A ModeBlock, version 0. This would identify the basic characterisics of
the algorithms used to calculate the data. [You might be able to omit this
block... I haven't tried.]
- A word-map block, version 1. This would contain the dwell values, as an
array of 16-bit integers (top row first). Each dwell is represented as a
15-bit value (the high-order bit may be set to indicate "uncertain,
recalculate this pixel"). A value of 32767 means "unknown", a value of
32766 means "in the M-set".
- An EOF block (header only, no data).
The file's type should be set to 'ManD', with a creator code of 'dcpM' (or
'dcpF' to designate ownership by FractalMagic Mac instead of MandelZot).
The resource fork is not used.
---------------------------------------------------
/* File types/owners, and so forth */
#define mySignature 'dcpM'
#define saveFileType 'ManD'
#define gifFileType 'GIFf'
#define tiffFileType 'TIFF'
#define pictFileType 'PICT'
#define colorSetFileType 'ManC'
typedef unsigned int Iter, *IterPtr, **IterHandle;
/* Masks and values for Iter data type, version 0 */
#define v0unknown 0x8000
#define v0scaled 0x4000
#define v0notCalced 0xC000
#define v0inTheSet 0x1000
#define v0countMask 0x0FFF
#define v0placeMask 0x1FFF
#define v0maxLegalDwell 0x0FFF
/* Masks and values for Iter data type, version 1 */
#define scaled 0x8000
#define placeMask 0x7FFF
#define unknown 0x7FFF
#define inTheSet 0x7FFE
#define maxLegalDwell 0x7FFD
typedef int boolean;
typedef struct Range{
double top;
double left;
double bottom;
double right;
} Range;
typedef struct {
double x;
double y;
} Complex, *ComplexPtr, **ComplexHandle;
typedef struct {long int word1, word2, word3;} ieeeExtended;
typedef struct {int oneWord [5];} saneExtended;
typedef struct { unsigned int high, low; } fakelong;
typedef unsigned int DwellMap, *DwellMapPtr, **DwellMapHandle;
typedef enum { restartCalcs, runCalcs, noMoreCalcs, continueCalcs } CalcPhase;
typedef enum { eofHeader = 0,
coordHeader = 1,
modeHeader = 2,
colorSetHeader = 3,
bitMapHeader = 4,
byteMapHeader = 5,
wordMapHeader = 6,
printRecordHeader = 7,
codeNameHeader = 8,
privateDataHeader = 9,
otherPrivateDataHeader = 10,
descriptiveStringHeader = 11,
compressedWordMapHeader = 12} FileHeaderType;
typedef enum { coordFile = 1,
bitMapFile,
dwellFile,
compressedDwellFile,
colorSetFile,
PICTFile,
TIFF8File,
TIFF24File } FileTypeID;
typedef enum { bandWidth = 1,
hideWhenSuspended = 3,
monochrome = 5,
patternedPen,
colorPen,
colorQD,
contrastCLUT = 10,
smoothCLUT,
customCLUT,
loadCLUT,
useAnimation = 15,
rotateIn = 17,
rotateOut,
redrawWindow = 20} DisplayMode;
typedef enum { randomOrder = 1,
rasterOrder,
lineOrder} CalcOrder;
typedef enum { chipMode = 1,
saneMode,
fixedPointMode,
integerMode } CalcMode;
typedef enum { settingsOk = 1,
settingsCancel,
saveCoordsOnly,
saveBitMap,
saveDwells,
savePICT,
saveTIFF8,
saveTIFF24,
saveColorSet,
saveCompressedDwells } SaveFileMode;
typedef enum { smooth,
contrast,
custom } CLUTmode;
typedef enum { Mariani_Silver,
successive_refinement,
modified_Mariani_Silver,
contour_crawl } DivConAlgorithm;
typedef enum { monoColor,
RGBblend,
HSVblend } PatchType;
typedef struct Patch {
int patchSize;
PatchType patchType;
RGBColor color[];
} Patch, *PatchPtr, **PatchHandle;
typedef struct Swatch {
int bandsCovered;
int swatchSize;
int patchCount;
Patch patch[];
} Swatch, *SwatchPtr, **SwatchHandle;
typedef struct ColorSet {
PaletteHandle paletteHandle;
int **bandMap;
int firstAnimated;
int bandsCovered;
int minDwell;
int anchorSwatch;
int anchorBand;
int anchorModulus;
RGBColor MColor;
int MColorIndex;
RGBColor borderColor;
int borderColorIndex;
int swatchCount;
Swatch swatch[];
} ColorSet, *ColorSetPtr, **ColorSetHandle;
typedef struct EditPatch {
PatchType patchType;
RGBColor color[2];
} EditPatch, *EditPatchPtr, **EditPatchHandle;
typedef struct EditSwatch {
int patchCount;
int bandsCovered;
boolean modified;
EditPatch patch[3];
} EditSwatch, *EditSwatchPtr, **EditSwatchHandle;
/* Save-file section header */
typedef struct FileSection {
long int signature;
int type;
int version;
long int byteCount;
} FileSection, *FileSectionPtr, **FileSectionHandle;
/* Coordinate save block, Version 2 */
typedef struct CoordBlock {
int width;
int height;
int maxDwell;
short double top;
short double left;
short double bottom;
short double right;
/* Version 0 data ends here */
boolean isJulia;
short double juliaReal;
short double juliaImag;
/* Version 1 data ends here */
saneExtended topExtended;
saneExtended leftExtended;
saneExtended bottomExtended;
saneExtended rightExtended;
saneExtended juliaRealExtended;
saneExtended juliaImagExtended;
} CoordBlock, CoordBlockPtr, CoordBlockHandle;
/* View-control save block, Version 7 */
typedef struct ModeBlock {
boolean showPrecalculatedSet;
DisplayMode displayMode;
CalcMode calcMode;
CalcOrder calcOrder;
CalcPhase calcPhase;
short double rMax;
/* Version 0 data ends here. */
int dwellsPerBand;
CLUTmode clutMode;
/* Version 1 data ends here. */
boolean rootScaling;
saneExtended rootScaleFactor;
/* Version 2 data ends here. */
boolean distanceEstimator;
saneExtended borderWidth;
/* Version 3 data ends here. */
DivConAlgorithm divConAlgorithm;
/* Version 4 data ends here. */
short double radiusCorrection;
boolean cutDisks;
/* Version 5 data ends here. */
boolean isBroadband;
/* Version 6 data ends here. */
DivConAlgorithm divConAlgorithm2;
} ModeBlock, *ModeBlockPtr, **ModeBlockHandle;
/*
ColorSetBlock, version 0. Swatches are tailed onto the end of this fixed
structure exactly as they appear in memory.
In the future... when adding stuff to the header, increment the header
version (currently 0) and add new variables at the end of the header.
Don't change the ColorBlockSet major version unless the swatch/patch
format changes in an incompatible way... the version-0 reader will
ignore ColorSetBlocks with a version > 0.
*/
typedef struct ColorSetBlock {
int headerSize;
int headerVersion;
int minDwell;
int anchorSwatch;
RGBColor MColor;
RGBColor borderColor;
int swatchCount;
} ColorSetBlock, *ColorSetBlockPtr, **ColorSetBlockHandle;